<?php

/*------------------------------------------------------------------------
 # com_k2store - K2 Store v 2.6
# ------------------------------------------------------------------------
# author    Ramesh Elamathi - Weblogicx India http://www.weblogicxindia.com
# copyright Copyright (C) 2012 Weblogicxindia.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://k2store.org
# Technical Support:  Forum - http://k2store.org/forum/index.html
-------------------------------------------------------------------------*/



// no direct access
defined('_JEXEC') or die('Restricted access');
require_once (JPATH_ADMINISTRATOR.'/components/com_k2store/library/select.php');
?>
<?php if(count($this->items)) : ?>
<div class="k2store_attribute_<?php echo $this->productattribute_id; ?>">
		<div class="k2store_wrapper">
<?php 	
	$list[] =  K2StoreSelect::option( '', JText::_('K2STORE_SELECT'));
        foreach ($this->items as $item)
        {
        	if($item->productattributeoption_prefix != '=')
        	{
        		$display_suffix = ($item->productattributeoption_price > '0') ? ": ".$item->productattributeoption_prefix.K2StorePrices::number($item->productattributeoption_price) : '';
        	}
        	else
        	{
        		$display_suffix = ($item->productattributeoption_price > '0') ? ": ".K2StorePrices::number($item->productattributeoption_price) : '';
        	}
        	$display_name = JText::_($item->productattributeoption_name).$display_suffix;
            $list[] =  K2StoreSelect::option( $item->productattributeoption_id, $display_name );
          
        }
        sort($list);
        $attribs = array();
        
        if($this->required) { 
        	$attribs = array('class' => 'inputbox required ', 'size'=>'1', 'title'=>JText::_('K2STORE_SELECT_AN_OPTION')); 
        }
        
     	echo  K2StoreSelect::genericlist($list, $this->name, $attribs, 'value', 'text', $this->selected=null, $this->idTag  );
?>
</div>
</div>
<div class="k2error"></div>
<?php endif; ?>